using System;
using System.ComponentModel;
using System.Transactions;

using SIS.ENT;
using SIS.DAL;


namespace SIS.BLL {

/// <summary>
/// The FamilyMemberContactTableManager class is responsible for managing BO.FamilyMemberContactTable objects in the system.
/// </summary>
[DataObjectAttribute()]
public class FamilyMemberContactTableManager
  {

#region "Public Methods"

/// <summary>
/// Gets a list with all FamilyMemberContactTable objects in the database.
/// </summary>
/// <returns>A list with all FamilyMemberContactTable from the database when the database contains any, or null otherwise.</returns>
[DataObjectMethod(DataObjectMethodType.Select, true)]
public static FamilyMemberContactTableList GetList(){
return FamilyMemberContactTableDB.GetList();
}

/// <summary>
/// Gets a single FamilyMemberContactTable from the database without its data.
/// </summary>
/// <param name="familyMemberContactKey">The FamilyMemberContactKey of the FamilyMemberContactTable in the database.</param>
/// <returns>A FamilyMemberContactTable object when the FamilyMemberContactKey exists in the database, or <see langword="null"/> otherwise.</returns>
[DataObjectMethod(DataObjectMethodType.Select, false)]
public static FamilyMemberContactTable GetItem(int familyMemberContactKey){
return GetItem(familyMemberContactKey, false);
}

public static FamilyMemberContactTable GetItemByUserAccountKey(int UserAccountKey)
{
    FamilyMemberContactTable _FamilyMemberContact = FamilyMemberContactTableDB.GetItemByUserAccountKey(UserAccountKey);
    return _FamilyMemberContact;
}

/// <summary>
/// Gets a single FamilyMemberContactTable from the database.
/// </summary>
/// <param name="familyMemberContactKey">The FamilyMemberContactKey of the FamilyMemberContactTable in the database.</param>
/// <param name="getFamilyMemberContactTableRecords">Determines whether to load all associated FamilyMemberContactTable records as well.</param>
/// <returns>
/// A FamilyMemberContactTable object when the FamilyMemberContactKey exists in the database, or <see langword="null"/> otherwise.
/// </returns>
[DataObjectMethod(DataObjectMethodType.Select, false)]
public static FamilyMemberContactTable GetItem(int familyMemberContactKey, bool getFamilyMemberContactTableRecords){
FamilyMemberContactTable myFamilyMemberContactTable = FamilyMemberContactTableDB.GetItem(familyMemberContactKey);
return myFamilyMemberContactTable;
}

/// <summary>
/// Saves a FamilyMemberContactTable in the database.
/// </summary>
/// <param name="myFamilyMemberContactTable">The FamilyMemberContactTable instance to save.</param>
/// <returns>The new FamilyMemberContactKey if the FamilyMemberContactTable is new in the database or the existing FamilyMemberContactKey when an item was updated.</returns>
[DataObjectMethod(DataObjectMethodType.Update, true)]
public static int Save(FamilyMemberContactTable myFamilyMemberContactTable){
using (TransactionScope myTransactionScope = new TransactionScope()){
int familyMemberContactTableFamilyMemberContactKey = FamilyMemberContactTableDB.Save(myFamilyMemberContactTable);

//  Assign the FamilyMemberContactTable its new (or existing FamilyMemberContactKey).
myFamilyMemberContactTable.FamilyMemberContactKey = familyMemberContactTableFamilyMemberContactKey;

myTransactionScope.Complete();

return familyMemberContactTableFamilyMemberContactKey;
}
}

/// <summary>
/// Deletes a FamilyMemberContactTable from the database.
/// </summary>
/// <param name="myFamilyMemberContactTable">The FamilyMemberContactTable instance to delete.</param>
/// <returns>Returns true when the object was deleted successfully, or false otherwise.</returns>
[DataObjectMethod(DataObjectMethodType.Delete, true)]
public static bool Delete(FamilyMemberContactTable myFamilyMemberContactTable){
return FamilyMemberContactTableDB.Delete(myFamilyMemberContactTable.FamilyMemberContactKey);
}

#endregion

}

}
